package com.iuschool.postprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;

/**
 * @author max
 * @version 1.0.0
 * @ClassName CustomizeBeanPostProcessor.java
 * @Description 每个bean实例生成都会调用下面两个方法,比如可以用于统计bean创建的时间
 * @createTime 2020年09月21日 18:22:00
 */
@Configuration
public class CustomizeBeanPostProcessor implements BeanPostProcessor {
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println(beanName + "调用了 postProcessBeforeInitialization");
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println(beanName + "调用了 postProcessAfterInitialization");
		return bean;
	}
}
